package me.baicai.weixin.identity.repository;

import com.alibaba.fastjson.JSONObject;
import me.baicai.weixin.entity.gcb.Help;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface HelpRepository extends JpaRepository<Help, Long>
{



    @Query(value = "SELECT id,shopName,address,latitude,longitude FROM shop WHERE (ACOS(SIN((?2 * 3.1415)/180) * SIN((latitude*3.1415)/180) + COS(( ?2 *3.1415)/180) * COS((latitude*3.1415)/180) * COS(( ?1 *3.1415)/180 - (longitude*3.1415)/180))*6370.996)<=5", nativeQuery = true)
    List<JSONObject> nearbyShop(String latitude, String longitude);

}
